package com.cgl.mapper;

import com.cgl.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Service;

@Mapper
public interface UserMapper {
    @Insert("INSERT INTO user(id, username, email, password, imagePath, createdTime, updatedTime, status, role, code) VALUES (#{id}, #{username}, #{email}, #{password}, #{imagePath}, #{createdTime}, #{updatedTime}, #{status}, #{role}, #{code})")
    int addUser(User user);

    @Select("SELECT * FROM user WHERE email=#{email} and password=#{password}")
    User selectUserByEmailAndPassword(User user);
    @Select("SELECT * FROM user WHERE id=#{id}")
    User selectUserById(String id);
}
